from typing import List, Optional
from pydantic import BaseModel, Field
from .base import BaseSchema
from .user import UserSchema

class Waypoint(BaseModel):
    """航点模型"""
    lat: float = Field(..., description="纬度")
    lng: float = Field(..., description="经度")
    alt: float = Field(..., description="高度")

class FlightRouteBase(BaseSchema):
    """航线基础模型"""
    name: str = Field(..., max_length=100, description="航线名称")
    description: Optional[str] = Field(None, max_length=255, description="航线描述")
    waypoints: List[Waypoint] = Field(..., description="航点列表")
    distance: Optional[float] = Field(None, description="航线距离")
    is_active: Optional[bool] = Field(True, description="是否激活")

class FlightRouteCreate(FlightRouteBase):
    """创建航线模型"""
    pass

class FlightRouteUpdate(FlightRouteBase):
    """更新航线模型"""
    pass

class FlightRouteSchema(FlightRouteBase):
    """航线响应模型"""
    created_user: Optional[UserSchema] = Field(None, description="创建用户信息")